This invention is in the technical field of using an instrument such as a camera or a scanner to obtain image data of a symbol including a visibly recognizable pattern such as a bar code and a two-dimensional code and encoding specified information and carrying out image processing on the symbol in the generated image to thereby read out the information represented by this symbol. Throughout herein, such visually recognizable data represented by a symbol, such as arrangements of black and white, density variations and color arrangements, will be referred to as “optical data” and the corresponding symbol will be referred to as “optical data code.”
Bar codes and two-dimensional codes are set so as to represent various data by distributing a white-black pattern according to a specified method. Two-dimensional codes can represent larger numbers of data than bar codes can because data-representing areas called “cells” are arranged two-dimensionally.
FIGS. 21A and 21B show respectively a data matrix and a QR code which are both a representative example of two-dimensional code. A data matrix has an L-shaped finder pattern 40 formed along two mutually perpendicular sides for defining the direction of the code and a likewise L-shaped timing pattern 41 is formed along the remaining two mutually perpendicular sides. The finder pattern 40 is usually formed by arranging black cells and the timing pattern 41 is usually formed by arranging black and white cells alternately.
A QR code usually includes three rectangular positioning symbols 42a, 42b and 42c to form a finder pattern 42. Each of the positioning symbols 42a, 42b and 42c is formed with a frame of white cells around a rectangular pattern made of a plurality of black cells and further with a frame of black cells around this white frame. These positioning symbols 42a, 42b and 42c are each distributed at a position representing a corner of the code, and an L-shaped pattern having black and white cells alternately is formed by connecting the inner angular parts of the symbols 42a, 42b and 42c. The relationship between black and white cells may be reversed, depending on the condition of the background both for the data matrix and for the QR code.
For reading a two-dimensional code as described above, an image processing method by an edge extraction process or a pattern matching process is used first to extract the finder pattern 40 or 42 on the image to ascertain the position and orientation of the code. Next, the timing pattern 41 or 43 is detected on the basis of the extracted finder pattern 40 or 42. The positions of the other cells are identified on the basis of the arrangement of black and white cells in this timing pattern 41 or 43.
Next, the image data of the identified cells are used to carry out the decoding process for converting the optical data represented by these cells into a data format recognizable by a computer. In this decoding process, a process such as binary conversion is used to determine whether each cell is black or white, and the optical data represented by the cells are encoded according to the results of such determinations. The codes of individual cells are arranged for each group of cells representing data for one character (symbol character) such that code data representing each character are generated. During this time while these conversions are made, a process (error correcting process) is carried out for correcting the errors committed while the black and while conditions of the cells are determined.
A two-dimensional code can be made very small in area by adjusting the size of its cells. Since a so-called direct marking method has recently been developed whereby laser light or a time-puncher pin is used to mark a code directly on the surface of a metal, it has become possible to easily mark a miniature two-dimensional code in a semi-permanently inerasable form even on small objects such as electronic components.
Systems making use of this direct marking method are currently being introduced such as a system for a production line in a factory for transporting products marked with a two-dimensional code and reading out the data represented by these codes during the course of the transportation of these products such that the destinations and treatment methods in their subsequent production steps can be identified. When such a system is introduced into a factory where data management must be carried out at a high level of accuracy, a careful adjustment must be made on the two-dimensional code reader when it is set such that two-dimensional codes can be read out reliably. For example, the image-taking device must be focused correctly and the illumination device must be adjusted such that the boundaries between the cells and the black and white conditions of the cells will not be misjudged and the size of the field of vision must be corrected such that the two-dimensional code will not move beyond the field of vision or the individual cells will not become smaller than the limit of dissolution.
Conventional two-dimensional code readers are adapted to calculate and output the readout ratio, or the ratio between the number of times decoding was successfully made and the total number of readout processes carried out. The readout ratio is the same, however, as long as the decoding is successful whether the image of the two-dimensional code is in an optimum condition or it is in a bad condition such that the decoding is nearly impossible. Thus, the user can neither determine with what margin of safety the optical data are being decoded nor make an adequate adjustment such that an image suitable for decoding may be obtained.
Japanese Patent Publication Tokkai 9-274636 discloses an optical code reader adapted to output data indicative of the degree of error corrections carried out at the time of a readout process. According to what is disclosed therein, maximum and minimum numbers of error corrections in a readout process are obtained and thereafter these numbers are converted into the maximum and minimum of error correction ratio or its complement. As the range determined by the maximum and minimum thus obtained is displayed, the level of error correction can be understood. In other words, the error correction ratio according to this disclosure is the ratio of the number of error corrections with respect to the number of errors that could be corrected. Thus, even if two-dimensional codes are successfully read out, it may be concluded that the margin of safety is small if the ratio of error correction is large.
This publication discloses the display of such error correction ratio being made in the test mode at the time of introduction during which a series of processes including the taking of the image of the code, extraction of the finder pattern, assignment of symbols to cells, correction of errors and decoding is carried out for a plurality of number of times while the two-dimensional code is kept stationary or moving and the aforementioned display is made on the basis of the maximum and minimum of the number of error corrections after a plurality of processes have been made.
The invention according to aforementioned Japanese Patent Publication Tokkai allows a user to know the extent to which error corrections have been made by executing the test mode explained above and to leave a sufficiently wide margin of safety for decoding by adjusting the image-taking device or illumination if the degree of error correction has been too large such that the ratio of correction can be reduced.
In the case of data management systems for factories, however, many two-dimensional codes must be processed sequentially at a high speed, and the margin of safety for decoding becomes smaller as the frequency of processes increases. One of the reasons for this may be that the two-dimensional codes themselves undergo changes. If two-dimensional codes are made by direct marking, for example, conditions of the code may change because the laser diode and time-punching pins used in the direct marking process do not fail to deteriorate. As a result of wears and tears of such devices for the direct marking, the image density or the cell size may change, making the decoding difficult.
The decoding becomes difficult also if the illumination condition changes, for example, because the lamp is getting old and the image density changes. There are other possible causes on the side of the two-dimensional code reader such as the displacement of the image-taking device causing a focusing error or a change in the size of the field of vision.
Since deterioration of the image of a two-dimensional image grows with the elapsed time, it is important to quickly detect a sign of degradation and to take a countermeasure, say, by replacing components that are wearing out. Since only a test mode is carried out at the beginning according to Japanese Patent Publication Tokkai 9-274636, it is difficult by this method to detect a situation where the quality of the image of a two-dimensional code has deteriorated so much while it is being read out that it is nearing the level where the decoding is almost impossible. By this method, the series of processes from the taking of an image of a code to the decoding is repeated several times in a cycle and the range of correction ratio is outputted for each cycle, but nothing much more. In other words, the user can only get a vague idea of the variation in the margin of safety in the decoding process and it is difficult to determine whether the quality of the image of a two-dimensional code is deteriorating or not.
Moreover, since it is extremely difficult for an ordinary user to guess the cause of an error simply by looking at the error correction ratio, it will take a long time for ascertaining the causes of the errors. Thus, a proper countermeasure cannot be taken in an efficient manner.
According to the method of aforementioned Japanese Patent Publication Tokkai 9-274636, furthermore, the number of error corrections is calculated for each symbol character. Thus, no matter how large is the number of cells where an error has occurred, the number of corrections is counted as 1. This means that it is difficult to determine from the number and ratio of error corrections alone how a two-dimensional code is suited for decoding.